package com.quasar.hpatient.view.adapter;
import android.text.Html;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.quasar.hpatient.R;
import com.quasar.hpatient.model.medicalmodel.ConsultationBean;
import com.quasar.hpatient.network.RetrofitConnection;

/**
 * author : 许建宏
 * Date: 2017/10/23 0023
 * View:咨询列表
 */

public class RecommendListAdapter extends BaseQuickAdapter<ConsultationBean, BaseViewHolder> {

    //绑定布局和绑定数据
    public RecommendListAdapter() {
        super(R.layout.collection_item_layout);
    }

    //绑定控件
    @Override
    protected void convert(BaseViewHolder helper, ConsultationBean item) {
        if (item.getTitle() != null) {
            helper.setText(R.id.consult_tv_title, Html.fromHtml(item.getTitle()));
        }
        //头像
        if (item.getCover() != null && item.getCover().length() > 0) {
            Glide.with(mContext).load(RetrofitConnection.PHOTOURL + item.getCover()).into((ImageView) helper.getView(R.id.consult_iv_pic));
        }
        //浏览量
        helper.setText(R.id.consult_tv_checknum,item.getHit()+"");
         //收藏量
        helper.setText(R.id.consult_tv_collectnum,item.getCollectNum()+"");
        //内容
        helper.setText(R.id.tv_count,item.getContent());
    }
}
